# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=silenttrinity
pkgver=293.08b1c61
pkgrel=5
pkgdesc="An asynchronous, collaborative post-exploitation agent powered by Python and .NET's DLR."
groups=('blackarch' 'blackarch-backdoor')
arch=('any')
url='https://github.com/byt3bl33d3r/SILENTTRINITY'
license=('GPL3')
depends=('python' 'python-aiofiles' 'python-aiosqlite' 'python-asn1crypto'
         'python-blinker' 'python-certifi' 'python-cffi' 'python-chardet'
         'python-click' 'python-cryptography' 'python-defusedxml'
         'python-dnslib' 'python-docopt' 'python-h2' 'python-hpack' 'python-h11'
         'hypercorn' 'python-hyperframe' 'python-idna' 'python-pypykatz'
         'python-itsdangerous' 'python-jinja' 'python-markupsafe'
         'python-multidict' 'python-netifaces' 'python-prompt_toolkit'
         'python-pycparser' 'python-pytoml' 'python-quart' 'python-requests'
         'python-six' 'python-sortedcontainers' 'python-termcolor'
         'python-terminaltables' 'python-typing_extensions' 'python-urllib3'
         'python-wcwidth' 'python-websockets' 'python-wsproto' 'python-winsspi'
         'python-pyasn1' 'python-minidump' 'python-minikerberos'
         'python-msldap' 'python-ldap3' 'python-aiowinreg' 'python-asciitree'
         'python-socks5line')
makedepends=('git')
source=("$pkgname::git+https://github.com/byt3bl33d3r/SILENTTRINITY.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" *.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm *.md LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python st.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"

  cat > "$pkgdir/usr/bin/$pkgname-teamserver" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python teamserver.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname-teamserver"
}

